package com.myedusys.config;

import com.myedusys.interceptor.JwtTokenAdminInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {


    @Autowired
    private JwtTokenAdminInterceptor jwtTokenAdminInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册拦截器，表示用户登录和注册的接口不需要拦截
        //其他都拦截，并且执行jwtTokenAdminInterceptor中的内容
        registry.addInterceptor(jwtTokenAdminInterceptor).excludePathPatterns("/user/login","/user/register");
    }
}
